package com.itheima.controller;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzOption;
import com.itheima.pojo.JobOption;
import com.itheima.pojo.Result;
import com.itheima.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@Slf4j
@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    private ReportService reportService;

    //统计各个职位的员工人数
    @GetMapping("/empJobData")
    public Result getEmpReport(){
        log.info("统计各个职位的员工人数");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }


     //统计员工性别信息

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("统计员工性别信息");
        List<Map> genderList = reportService.getEmpGenderData();
        return Result.success(genderList);
    }

    //学员学历统计
    //    请求路径：/report/studentDegreeData
    //    请求方式：GET
    //    接口描述：该接口用于统计学员学历信息
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("学员学历统计");
        List<Map> degreeList = reportService.getStudentDegreeData();
        return Result.success(degreeList);
    }

    //班级人数统计
    //请求路径：/report/studentCountData
    //请求方式：GET
    //接口描述：统计每一个班级的人数
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){

        log.info("班级人数统计");
        ClazzOption clazzOption = reportService.getStudentCountData();
        return Result.success(clazzOption);
    }


}
